
create  function dbo.sf_plazoReal( @idlote varchar(10) )
returns int 
as
begin
	declare @retVal int
	set	@retVal = 0
	select	@retVal = isnull( count(*),  0 )
	from	detVenta
	where	cvelote = @idlote
	return  @retVal
end


GO